package com.sea.supply.controller;

import com.codecrane.core.web.Ajax;
import com.codecrane.core.web.AjaxReturn;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionHandleController {
    @ResponseBody
    @ExceptionHandler(UnauthorizedException.class)
    public AjaxReturn handleShiroException(Exception ex) {
        return  Ajax.fail().setMsg("没有权限！");
    }
}
